--------------------------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  C:\Users\wb614536\Downloads\replication\replication\code\../outputs/12_FiscalAnalysisW2_log.txt
  log type:  text
 opened on:  25 Jun 2026, 13:02:20
r; t=0.00 13:02:20

. 
. /*------------------------------------------------------------------
>   PARAMETERS (from JEEA Online Appendix N, 2020 USD unless noted)
> ------------------------------------------------------------------*/
. 
. * --- Tax rates ---
. local vat_food     = 0.053          // food VAT
r; t=0.00 13:02:20

. local vat_nonfood  = 0.19           // non-food VAT
r; t=0.00 13:02:20

. local food_share   = 0.30           // assumed food share of consumption
r; t=0.00 13:02:20

. local payroll_rate = 0.285          // 12.5% health + 16% pensions
r; t=0.00 13:02:20

. 
. * --- Healthcare costs per member-year (USD) ---
. local hc_irreg     = 407.1          // irregular migrant: subsidised UPC + ER extra
r; t=0.00 13:02:20

. local hc_pep       = 224.6          // PEP migrant: subsidised UPC only
r; t=0.00 13:02:20

. local hc_kid_0_5   = 430.2          // 0-5 yr without PEP (extra UPC ER)
r; t=0.00 13:02:20

. local hc_kid_0_5_p = 247.7          // 0-5 yr with PEP
r; t=0.00 13:02:20

. 
. * --- Education and social assistance per member-year (USD) ---
. local edu_kid_6_18    = 1048.05    // primary/secondary/tertiary weighted (universal)
r; t=0.00 13:02:20

. local soc_kid_0_5     = 350.83     // early childhood, no PEP universal
r; t=0.00 13:02:20

. local soc_kid_0_5_pep = 392.10     // early childhood, with PEP universal
r; t=0.00 13:02:20

. local soc_kid_6_18_p  = 107.1      // CCT (Familias en Acción) for PEP HH
r; t=0.00 13:02:20

. 
. * --- De-facto (observed) access shares from W1 JEEA Table N.1 (used to
. *     scale universal costs).  We will compare against W2 observed rates. ---
. local edu_defacto_nopep   = 0.589     // 617.23 / 1048.05
r; t=0.00 13:02:20

. local edu_defacto_pep     = 0.843     // 883.56 / 1048.05
r; t=0.00 13:02:20

. local soc_defacto_nopep   = 0.110     // 38.59 / 350.83
r; t=0.00 13:02:20

. local soc_defacto_pep     = 0.285     // 111.5 / 392.1
r; t=0.00 13:02:20

. local hc_defacto_nopep    = 0.540     // 219.8 / 407.1
r; t=0.00 13:02:20

. local hc_defacto_pep      = 0.587     // 131.7 / 224.6
r; t=0.00 13:02:20

. 
. * --- Exchange rate ---
. local cop_to_usd_2021 = 3743          // Banco de la República 2021 average
r; t=0.00 13:02:20

. 
. /*------------------------------------------------------------------
>   SAMPLE: JEEA-style W2 analysis sample
> ------------------------------------------------------------------*/
. 
. use "$clean/PEP_Analysis_Sample.dta", clear
(PEP analysis sample (JEEA-style + extended outcome indices))
r; t=0.14 13:02:20

. local jeea_controls hhven_spouse hhven_other jobopp labven typeworkven1 ///
>                     typeworkven2 typeworkven3 written_cont average yrseduc ///
>                     healthmig frdfam smartven owner electven waterven ///
>                     sewageven female age_panel child_venez time_col
r; t=0.00 13:02:20

. gen sample_roster = .
(13,580 missing values generated)
r; t=0.00 13:02:20

. qui reg trt_hh `jeea_controls'
r; t=2.36 13:02:22

. replace sample_roster = e(sample)
(13,580 real changes made)
r; t=0.00 13:02:22

. replace sample_roster = 0 if gasto_capita == . & trt_hh != .
(119 real changes made)
r; t=0.00 13:02:22

. replace sample_roster = 0 if employed == . & trt_hh != .
(88 real changes made)
r; t=0.00 13:02:22

. replace sample_roster = 0 if hora_semana == . & trt_hh != . & asalariado_num == 1
(64 real changes made)
r; t=0.00 13:02:22

. replace sample_roster = 0 if anx_depr == .
(2 real changes made)
r; t=0.00 13:02:22

. replace sample_roster = 0 if health_pca == .
(8 real changes made)
r; t=0.00 13:02:22

. bysort family_id wave_num: egen sample_reg = max(sample_roster)
r; t=0.01 13:02:22

. keep if (orden == 1 | orden == 2) & sample_reg == 1
(6,604 observations deleted)
r; t=0.02 13:02:22

. keep if wave_num == 2
(4,317 observations deleted)
r; t=0.01 13:02:22

. 
. di "  W2 fiscal sample size: " _N
  W2 fiscal sample size: 2659
r; t=0.00 13:02:22

. 
. /*------------------------------------------------------------------
>   PER-CAPITA CONSUMPTION AND LABOR INCOME IN USD
> ------------------------------------------------------------------*/
. 
. * Units in 00_BuildPanel.do:
. *   gasto_capita_raw  : ANNUAL per-capita consumption, MILLIONS of COP
. *   labour_income_raw : MONTHLY individual labor income, COP (not millions)
. gen pc_cons_usd = gasto_capita_raw * 1000000 / `cop_to_usd_2021'
r; t=0.00 13:02:22

. gen labinc_usd  = labour_income_raw * 12 / `cop_to_usd_2021'
(884 missing values generated)
r; t=0.00 13:02:22

. 
. * Group: 1=non-PEP, 2=PEP informal, 3=PEP formal
. gen group = .
(2,659 missing values generated)
r; t=0.00 13:02:22

. replace group = 1 if pep == 0
(1,291 real changes made)
r; t=0.00 13:02:22

. replace group = 2 if pep == 1 & formal == 0
(578 real changes made)
r; t=0.00 13:02:22

. replace group = 3 if pep == 1 & formal == 1
(100 real changes made)
r; t=0.00 13:02:22

. 
. di ""

r; t=0.00 13:02:22

. di "  Avg per-capita annual consumption (USD), W2:"
  Avg per-capita annual consumption (USD), W2:
r; t=0.00 13:02:22

. forvalues g = 1/3 {
  2.     qui sum pc_cons_usd if group == `g' & orden == 1
  3.     local cons_`g' = cond(r(N) > 0, r(mean), .)
  4.     di "    Group `g': $" %8.0f `cons_`g''
  5. }
    Group 1: $    1043
    Group 2: $    1474
    Group 3: $    1587
r; t=0.00 13:02:22

. 
. di ""

r; t=0.00 13:02:22

. di "  Avg labor income (USD), W2 formal workers only:"
  Avg labor income (USD), W2 formal workers only:
r; t=0.00 13:02:22

. qui sum labinc_usd if group == 3
r; t=0.00 13:02:22

. local inc_3 = cond(r(N) > 0, r(mean), .)
r; t=0.00 13:02:22

. di "    Formal: $" %8.0f `inc_3'
    Formal: $    3353
r; t=0.00 13:02:22

. 
. * Share of PEP holders who are formally employed (drives "PEP partial" column)
. qui sum formal if pep == 1 & inrange(age_panel, 18, 65)
r; t=0.00 13:02:22

. local formal_share = r(mean)
r; t=0.00 13:02:22

. di "    Formality share among PEP working-age adults: " %5.3f `formal_share'
    Formality share among PEP working-age adults: 0.147
r; t=0.00 13:02:22

. 
. /*------------------------------------------------------------------
>   HH COMPOSITION (W2 averages, members per HH by age bin)
> ------------------------------------------------------------------*/
. 
. preserve
r; t=0.01 13:02:22

. * Use the full roster (not just orden 1/2) for composition counts
. use "$clean/PEP_Analysis_Sample.dta", clear
(PEP analysis sample (JEEA-style + extended outcome indices))
r; t=0.09 13:02:22

. keep if wave_num == 2
(8,229 observations deleted)
r; t=0.02 13:02:22

. gen kid_0_5    = (age_panel <= 5)
r; t=0.00 13:02:22

. gen kid_6_18   = (age_panel >= 6  & age_panel <= 18)
r; t=0.00 13:02:22

. gen adult_1925 = (age_panel >= 19 & age_panel <= 25)
r; t=0.00 13:02:22

. gen adult_2645 = (age_panel >= 26 & age_panel <= 45)
r; t=0.00 13:02:22

. gen adult_4665 = (age_panel >= 46 & age_panel <= 65)
r; t=0.00 13:02:22

. gen adult_66p  = (age_panel >= 66)
r; t=0.00 13:02:22

. collapse (sum) kid_0_5 kid_6_18 adult_1925 adult_2645 adult_4665 adult_66p, ///
>     by(family_id)
r; t=0.04 13:02:22

. foreach v in kid_0_5 kid_6_18 adult_1925 adult_2645 adult_4665 adult_66p {
  2.     qui sum `v'
  3.     local n_`v' = r(mean)
  4. }
r; t=0.01 13:02:22

. di ""

r; t=0.00 13:02:22

. di "  Avg HH composition (W2):"
  Avg HH composition (W2):
r; t=0.00 13:02:22

. di "    kid_0_5    = " %5.2f `n_kid_0_5'
    kid_0_5    =  0.49
r; t=0.00 13:02:22

. di "    kid_6_18   = " %5.2f `n_kid_6_18'
    kid_6_18   =  0.88
r; t=0.00 13:02:22

. di "    adult_1925 = " %5.2f `n_adult_1925'
    adult_1925 =  0.39
r; t=0.00 13:02:22

. di "    adult_2645 = " %5.2f `n_adult_2645'
    adult_2645 =  1.20
r; t=0.00 13:02:22

. di "    adult_4665 = " %5.2f `n_adult_4665'
    adult_4665 =  0.35
r; t=0.00 13:02:22

. di "    adult_66p  = " %5.2f `n_adult_66p'
    adult_66p  =  0.20
r; t=0.00 13:02:22

. local hh_size = `n_kid_0_5' + `n_kid_6_18' + `n_adult_1925' + ///
>                 `n_adult_2645' + `n_adult_4665' + `n_adult_66p'
r; t=0.00 13:02:22

. local n_kids  = `n_kid_0_5' + `n_kid_6_18'
r; t=0.00 13:02:22

. local n_adult = `n_adult_1925' + `n_adult_2645' + `n_adult_4665' + `n_adult_66p'
r; t=0.00 13:02:22

. di "    HH size    = " %5.2f `hh_size'
    HH size    =  3.52
r; t=0.00 13:02:22

. restore
r; t=0.01 13:02:22

. 
. /*------------------------------------------------------------------
>   REVENUE PER HH (USD per year)
> ------------------------------------------------------------------*/
. 
. local vat_blend = `food_share' * `vat_food' + (1 - `food_share') * `vat_nonfood'
r; t=0.00 13:02:22

. di ""

r; t=0.00 13:02:22

. di "  Blended VAT rate: " %5.3f `vat_blend'
  Blended VAT rate: 0.149
r; t=0.00 13:02:22

. 
. * VAT applied to per-capita consumption × HH size, by group
. forvalues g = 1/3 {
  2.     local vat_`g' = `cons_`g'' * `vat_blend' * `hh_size'
  3. }
r; t=0.00 13:02:22

. 
. * Payroll: paid only by formal PEP workers (group 3)
. local payroll_3 = `inc_3' * `payroll_rate' * `n_adult' * 1
r; t=0.00 13:02:22

. * For "PEP partial formal" we scale payroll by the observed formal share
. local payroll_part = `inc_3' * `payroll_rate' * `n_adult' * `formal_share'
r; t=0.00 13:02:22

. 
. * Total revenue per HH per group
. local rev_nopep   = `vat_1' + 0
r; t=0.00 13:02:22

. local rev_inform  = `vat_2' + 0
r; t=0.00 13:02:22

. local rev_formal  = `vat_3' + `payroll_3'
r; t=0.00 13:02:22

. local rev_partial = `vat_2' + `payroll_part'
r; t=0.00 13:02:22

. 
. di ""

r; t=0.00 13:02:22

. di "  Revenue per HH (USD/year):"
  Revenue per HH (USD/year):
r; t=0.00 13:02:22

. di "    Non-PEP        : $" %7.0f `rev_nopep'
    Non-PEP        : $    546
r; t=0.00 13:02:22

. di "    PEP informal   : $" %7.0f `rev_inform'
    PEP informal   : $    772
r; t=0.00 13:02:22

. di "    PEP formal     : $" %7.0f `rev_formal'
    PEP formal     : $   2882
r; t=0.00 13:02:22

. di "    PEP partial    : $" %7.0f `rev_partial' "  (`formal_share' formal share)"
    PEP partial    : $   1074  (.1474926253687316 formal share)
r; t=0.00 13:02:22

. 
. /*------------------------------------------------------------------
>   EXPENDITURE PER HH (USD per year)
>   Two scenarios: de jure (universal) and de facto (observed shares)
> ------------------------------------------------------------------*/
. 
. * Healthcare cost per HH-year, by group
. local hc_pep_kid_0_5  = `hc_kid_0_5_p' * `n_kid_0_5'
r; t=0.00 13:02:22

. local hc_nopep_kid_0_5 = `hc_kid_0_5'  * `n_kid_0_5'
r; t=0.00 13:02:22

. local hc_pep_other    = `hc_pep'   * (`n_kid_6_18' + `n_adult')
r; t=0.00 13:02:22

. local hc_nopep_other  = `hc_irreg' * (`n_kid_6_18' + `n_adult')
r; t=0.00 13:02:22

. 
. * DE JURE healthcare
. local hc_dj_nopep  = `hc_nopep_kid_0_5' + `hc_nopep_other'
r; t=0.00 13:02:22

. local hc_dj_pep    = `hc_pep_kid_0_5'   + `hc_pep_other'
r; t=0.00 13:02:22

. 
. * DE FACTO healthcare (scaled by observed access)
. local hc_df_nopep  = `hc_dj_nopep' * `hc_defacto_nopep'
r; t=0.00 13:02:22

. local hc_df_pep    = `hc_dj_pep'   * `hc_defacto_pep'
r; t=0.00 13:02:22

. 
. * Education
. local edu_dj   = `edu_kid_6_18' * `n_kid_6_18'
r; t=0.00 13:02:22

. local edu_df_nopep = `edu_dj' * `edu_defacto_nopep'
r; t=0.00 13:02:22

. local edu_df_pep   = `edu_dj' * `edu_defacto_pep'
r; t=0.00 13:02:22

. 
. * Social assistance
. local soc_dj_nopep = `soc_kid_0_5'     * `n_kid_0_5'
r; t=0.00 13:02:22

. local soc_dj_pep   = `soc_kid_0_5_pep' * `n_kid_0_5' + `soc_kid_6_18_p' * `n_kid_6_18'
r; t=0.00 13:02:22

. local soc_df_nopep = `soc_dj_nopep' * `soc_defacto_nopep'
r; t=0.00 13:02:22

. local soc_df_pep   = `soc_dj_pep'   * `soc_defacto_pep'
r; t=0.00 13:02:22

. 
. * Total expenditure
. local exp_dj_nopep   = `hc_dj_nopep' + `edu_dj' + `soc_dj_nopep'
r; t=0.00 13:02:22

. local exp_dj_inform  = `hc_dj_pep'   + `edu_dj' + `soc_dj_pep'
r; t=0.00 13:02:22

. local exp_dj_formal  = `hc_dj_pep'   + `edu_dj' + `soc_dj_pep'
r; t=0.00 13:02:22

. local exp_df_nopep   = `hc_df_nopep' + `edu_df_nopep' + `soc_df_nopep'
r; t=0.00 13:02:22

. local exp_df_inform  = `hc_df_pep'   + `edu_df_pep'   + `soc_df_pep'
r; t=0.00 13:02:22

. local exp_df_formal  = `hc_df_pep'   + `edu_df_pep'   + `soc_df_pep'
r; t=0.00 13:02:22

. local exp_df_partial = `exp_df_inform' * (1 - `formal_share') + `exp_df_formal' * `formal_share'
r; t=0.00 13:02:22

. local exp_dj_partial = `exp_dj_inform' * (1 - `formal_share') + `exp_dj_formal' * `formal_share'
r; t=0.00 13:02:22

. 
. * Net cost = expenditure - revenue
. local net_dj_nopep   = `exp_dj_nopep'   - `rev_nopep'
r; t=0.00 13:02:22

. local net_dj_inform  = `exp_dj_inform'  - `rev_inform'
r; t=0.00 13:02:22

. local net_dj_formal  = `exp_dj_formal'  - `rev_formal'
r; t=0.00 13:02:22

. local net_dj_partial = `exp_dj_partial' - `rev_partial'
r; t=0.00 13:02:22

. local net_df_nopep   = `exp_df_nopep'   - `rev_nopep'
r; t=0.00 13:02:22

. local net_df_inform  = `exp_df_inform'  - `rev_inform'
r; t=0.00 13:02:22

. local net_df_formal  = `exp_df_formal'  - `rev_formal'
r; t=0.00 13:02:22

. local net_df_partial = `exp_df_partial' - `rev_partial'
r; t=0.00 13:02:22

. 
. /*------------------------------------------------------------------
>   WRITE RAW TXT
> ------------------------------------------------------------------*/
. 
. file open R using "$out/12_Fiscal_W2.txt", write replace text
(file ../outputs/12_Fiscal_W2.txt not found)
r; t=0.00 13:02:22

. file write R "scenario" _tab "group" _tab "revenue" _tab "exp_total" _tab ///
>             "exp_health" _tab "exp_education" _tab "exp_social" _tab "net_cost" _newline
r; t=0.00 13:02:22

. foreach sc in dj df {
  2.     foreach gr in nopep inform formal partial {
  3.         if "`sc'" == "dj" {
  4.             local h = cond("`gr'" == "nopep", `hc_dj_nopep', `hc_dj_pep')
  5.             local e = cond("`gr'" == "nopep", `edu_dj', `edu_dj')
  6.             local s = cond("`gr'" == "nopep", `soc_dj_nopep', `soc_dj_pep')
  7.         }
  8.         else {
  9.             local h = cond("`gr'" == "nopep", `hc_df_nopep', `hc_df_pep')
 10.             local e = cond("`gr'" == "nopep", `edu_df_nopep', `edu_df_pep')
 11.             local s = cond("`gr'" == "nopep", `soc_df_nopep', `soc_df_pep')
 12.         }
 13.         local r = `rev_`gr''
 14.         local exp_total = `exp_`sc'_`gr''
 15.         local nc = `net_`sc'_`gr''
 16.         file write R "`sc'" _tab "`gr'" _tab ///
>             "`=string(`r', "%9.2f")'" _tab ///
>             "`=string(`exp_total', "%9.2f")'" _tab ///
>             "`=string(`h', "%9.2f")'" _tab ///
>             "`=string(`e', "%9.2f")'" _tab ///
>             "`=string(`s', "%9.2f")'" _tab ///
>             "`=string(`nc', "%9.2f")'" _newline
 17.     }
 18. }
r; t=0.00 13:02:22

. file close R
r; t=0.00 13:02:22

. 
. /*------------------------------------------------------------------
>   WRITE LATEX TABLE
> ------------------------------------------------------------------*/
. 
. file open T using "$atab/tabA_fiscal_w2.tex", write replace text
r; t=0.01 13:02:22

. file write T "\begin{table}[!htbp]" _n
r; t=0.00 13:02:22

. file write T "\centering" _n
r; t=0.00 13:02:22

. file write T "\caption{Wave 2 (2021) fiscal net cost of a representative migrant household, replicating Iba\~{n}ez
>  et al.\ (2024) Table 7}" _n
r; t=0.00 13:02:22

. file write T "\label{tab:fiscal_w2}" _n
r; t=0.00 13:02:22

. file write T "\begin{threeparttable}" _n
r; t=0.00 13:02:22

. file write T "\begin{tabular}{l*{8}{c}}" _n
r; t=0.00 13:02:22

. file write T "\toprule" _n
r; t=0.00 13:02:22

. file write T " & \multicolumn{4}{c}{Universal access (de jure)} & \multicolumn{4}{c}{In-sample access (de facto)} 
> \\" _n
r; t=0.00 13:02:22

. file write T "\cmidrule(lr){2-5} \cmidrule(lr){6-9}" _n
r; t=0.00 13:02:22

. file write T " & Without & PEP & PEP & PEP partial & Without & PEP & PEP & PEP partial \\" _n
r; t=0.00 13:02:22

. file write T " & PEP & informal & formal & formal & PEP & informal & formal & formal \\" _n
r; t=0.00 13:02:22

. file write T " & (1) & (2) & (3) & (4) & (5) & (6) & (7) & (8) \\" _n
r; t=0.00 13:02:22

. file write T "\midrule" _n
r; t=0.00 13:02:22

. * Helper macro for "as integer string"
. foreach k in rev_nopep rev_inform rev_formal rev_partial ///
>              vat_1 vat_2 vat_3 payroll_3 payroll_part ///
>              exp_dj_nopep exp_dj_inform exp_dj_formal exp_dj_partial ///
>              exp_df_nopep exp_df_inform exp_df_formal exp_df_partial ///
>              hc_dj_nopep hc_dj_pep hc_df_nopep hc_df_pep ///
>              edu_dj edu_df_nopep edu_df_pep ///
>              soc_dj_nopep soc_dj_pep soc_df_nopep soc_df_pep ///
>              net_dj_nopep net_dj_inform net_dj_formal net_dj_partial ///
>              net_df_nopep net_df_inform net_df_formal net_df_partial {
  2.     local s_`k' = string(``k'', "%5.0f")
  3. }
r; t=0.00 13:02:22

. 
. file write T "Fiscal revenue & `s_rev_nopep' & `s_rev_inform' & `s_rev_formal' & `s_rev_partial' & `s_rev_nopep' &
>  `s_rev_inform' & `s_rev_formal' & `s_rev_partial' \\" _n
r; t=0.00 13:02:22

. file write T "\quad VAT & `s_vat_1' & `s_vat_2' & `s_vat_3' & `s_vat_2' & `s_vat_1' & `s_vat_2' & `s_vat_3' & `s_v
> at_2' \\" _n
r; t=0.00 13:02:22

. file write T "\quad Payroll & 0 & 0 & `s_payroll_3' & `s_payroll_part' & 0 & 0 & `s_payroll_3' & `s_payroll_part' 
> \\" _n
r; t=0.00 13:02:22

. file write T "\midrule" _n
r; t=0.00 13:02:22

. file write T "Expenditure & `s_exp_dj_nopep' & `s_exp_dj_inform' & `s_exp_dj_formal' & `s_exp_dj_partial' & `s_exp
> _df_nopep' & `s_exp_df_inform' & `s_exp_df_formal' & `s_exp_df_partial' \\" _n
r; t=0.00 13:02:22

. file write T "\quad Healthcare & `s_hc_dj_nopep' & `s_hc_dj_pep' & `s_hc_dj_pep' & `s_hc_dj_pep' & `s_hc_df_nopep'
>  & `s_hc_df_pep' & `s_hc_df_pep' & `s_hc_df_pep' \\" _n
r; t=0.00 13:02:22

. file write T "\quad Education & `s_edu_dj' & `s_edu_dj' & `s_edu_dj' & `s_edu_dj' & `s_edu_df_nopep' & `s_edu_df_p
> ep' & `s_edu_df_pep' & `s_edu_df_pep' \\" _n
r; t=0.00 13:02:22

. file write T "\quad Social assistance & `s_soc_dj_nopep' & `s_soc_dj_pep' & `s_soc_dj_pep' & `s_soc_dj_pep' & `s_s
> oc_df_nopep' & `s_soc_df_pep' & `s_soc_df_pep' & `s_soc_df_pep' \\" _n
r; t=0.00 13:02:22

. file write T "\midrule" _n
r; t=0.00 13:02:22

. file write T "\textbf{Net fiscal cost} & `s_net_dj_nopep' & `s_net_dj_inform' & `s_net_dj_formal' & `s_net_dj_part
> ial' & `s_net_df_nopep' & `s_net_df_inform' & `s_net_df_formal' & `s_net_df_partial' \\" _n
r; t=0.00 13:02:22

. file write T "\bottomrule" _n
r; t=0.00 13:02:22

. file write T "\end{tabular}" _n
r; t=0.00 13:02:22

. file write T "\begin{tablenotes}\footnotesize" _n
r; t=0.00 13:02:22

. file write T "\item \textit{Notes}: Fiscal cost-benefit analysis using \textbf{Wave 2 (2021)} household averages o
> f per-capita consumption, labor income, formality status, and household composition. Tax rates and unit costs are 
> held at their JEEA-published values (2020 USD; Online Appendix N), so any difference from JEEA Table 7 reflects su
> rvey-measured changes between waves. Quantities are in 2020 USD (per HH per year). Net cost = Expenditure -- Fisca
> l revenue. \textit{De jure} columns assume universal access to services as established by Colombian law; \textit{d
> e facto} columns scale healthcare, education, and social-assistance costs by the within-sample access shares from 
> JEEA Online Appendix N. \textit{Without PEP} (cols.\ 1, 5): all eligible HH members are non-regularized. \textit{P
> EP informal} (cols.\ 2, 6): all PEP holders, none formally employed. \textit{PEP formal} (cols.\ 3, 7): all PEP ho
> lders formally employed, paying payroll taxes. \textit{PEP partial formal} (cols.\ 4, 8): observed share of formal
>  employment in the W2 PEP working-age sample." _n
r; t=0.00 13:02:22

. file write T "\end{tablenotes}" _n
r; t=0.00 13:02:22

. file write T "\end{threeparttable}" _n
r; t=0.00 13:02:22

. file write T "\end{table}" _n
r; t=0.00 13:02:22

. file close T
r; t=0.00 13:02:22

. 
. di ""

r; t=0.00 13:02:22

. di "  tabA_fiscal_w2.tex saved"
  tabA_fiscal_w2.tex saved
r; t=0.00 13:02:22

. 
. /*------------------------------------------------------------------
>   FIGURE: Per-Capita Fiscal Balance by Wave and Eligibility Group
>   Clustered bar chart comparing W1 vs W2 for non-PEP (ineligible)
>   and PEP-partial-formal (eligible) groups. W2 values come from
>   this do-file; W1 values are the published JEEA Table 7 (Online
>   Appendix N) numbers cited in the paper intro.
>   Output: outputs/figures/fig_fiscal.pdf
> ------------------------------------------------------------------*/
. 
. global tfigs "../outputs/figures"
r; t=0.00 13:02:22

. capture mkdir "$tfigs"
r; t=0.00 13:02:22

. 
. * W1 values (JEEA Table 7, Online Appendix N, 2020 USD per HH per year).
. * Net cost = expenditure - revenue. Negative = net contribution to fiscus.
. local w1_net_nopep   = 1056
r; t=0.00 13:02:22

. local w1_net_partial = 610
r; t=0.00 13:02:22

. 
. * W2 values (computed above)
. local w2_net_nopep   = `net_df_nopep'
r; t=0.00 13:02:22

. local w2_net_partial = `net_df_partial'
r; t=0.00 13:02:22

. 
. * Negate so that "fiscal balance" = -net_cost (positive = net contribution).
. local w1_bal_nopep   = -`w1_net_nopep'
r; t=0.00 13:02:22

. local w1_bal_partial = -`w1_net_partial'
r; t=0.00 13:02:22

. local w2_bal_nopep   = -`w2_net_nopep'
r; t=0.00 13:02:22

. local w2_bal_partial = -`w2_net_partial'
r; t=0.00 13:02:22

. 
. di ""

r; t=0.00 13:02:22

. di "  Fiscal balances for figure (2020 USD per HH per year):"
  Fiscal balances for figure (2020 USD per HH per year):
r; t=0.00 13:02:22

. di "    W1 ineligible : $" %7.0f `w1_bal_nopep'
    W1 ineligible : $  -1056
r; t=0.00 13:02:22

. di "    W1 PEP-partial: $" %7.0f `w1_bal_partial'
    W1 PEP-partial: $   -610
r; t=0.00 13:02:22

. di "    W2 ineligible : $" %7.0f `w2_bal_nopep'
    W2 ineligible : $   -796
r; t=0.00 13:02:22

. di "    W2 PEP-partial: $" %7.0f `w2_bal_partial'
    W2 PEP-partial: $   -256
r; t=0.00 13:02:22

. 
. * Build a small dataset for the figure
. preserve
r; t=0.01 13:02:22

. clear
r; t=0.00 13:02:22

. set obs 4
Number of observations (_N) was 0, now 4.
r; t=0.00 13:02:22

. gen wave  = .
(4 missing values generated)
r; t=0.00 13:02:22

. gen group = .
(4 missing values generated)
r; t=0.00 13:02:22

. gen bal   = .
(4 missing values generated)
r; t=0.00 13:02:22

. replace wave = 1 in 1
(1 real change made)
r; t=0.00 13:02:22

. replace wave = 1 in 2
(1 real change made)
r; t=0.00 13:02:22

. replace wave = 2 in 3
(1 real change made)
r; t=0.00 13:02:22

. replace wave = 2 in 4
(1 real change made)
r; t=0.00 13:02:22

. replace group = 1 in 1   // PEP-eligible (partial-formal)
(1 real change made)
r; t=0.00 13:02:22

. replace group = 2 in 2   // Ineligible
(1 real change made)
r; t=0.00 13:02:22

. replace group = 1 in 3
(1 real change made)
r; t=0.00 13:02:22

. replace group = 2 in 4
(1 real change made)
r; t=0.00 13:02:22

. replace bal = `w1_bal_partial' in 1
(1 real change made)
r; t=0.00 13:02:22

. replace bal = `w1_bal_nopep'   in 2
(1 real change made)
r; t=0.00 13:02:22

. replace bal = `w2_bal_partial' in 3
(1 real change made)
r; t=0.00 13:02:22

. replace bal = `w2_bal_nopep'   in 4
(1 real change made)
r; t=0.00 13:02:22

. 
. label define waveL 1 "Wave 1 (3.5 years)" 2 "Wave 2 (4.5 years)"
r; t=0.00 13:02:22

. label values wave waveL
r; t=0.00 13:02:22

. label define groupL 1 "PEP-eligible" 2 "Ineligible comparison"
r; t=0.00 13:02:22

. label values group groupL
r; t=0.00 13:02:22

. 
. * Position bars side by side at each wave
. gen xpos = .
(4 missing values generated)
r; t=0.00 13:02:22

. replace xpos = 1   if wave == 1 & group == 1
(1 real change made)
r; t=0.00 13:02:22

. replace xpos = 1.7 if wave == 1 & group == 2
(1 real change made)
r; t=0.00 13:02:22

. replace xpos = 3   if wave == 2 & group == 1
(1 real change made)
r; t=0.00 13:02:22

. replace xpos = 3.7 if wave == 2 & group == 2
(1 real change made)
r; t=0.00 13:02:22

. 
. * Position labels just below each bar (bars are negative, so labels go above the bar top toward zero)
. gen lblpos = bal + 60
r; t=0.00 13:02:22

. * And a string label of the dollar amount with a leading minus sign
. gen str10 ballbl = "$" + string(round(bal), "%5.0f")
r; t=0.00 13:02:22

. replace ballbl = "-" + ballbl if bal < 0 & strpos(ballbl, "-") == 0
(0 real changes made)
r; t=0.00 13:02:22

. replace ballbl = string(round(bal), "%5.0fc") if 1 == 0  // placeholder
(0 real changes made)
r; t=0.00 13:02:22

. replace ballbl = string(round(bal), "%5.0fc")  // use comma-grouped
(4 real changes made)
r; t=0.00 13:02:22

. 
. twoway ///
>     (bar bal xpos if group == 1, barwidth(0.6) fcolor("170 30 60") lcolor("170 30 60") lwidth(thin)) ///
>     (bar bal xpos if group == 2, barwidth(0.6) fcolor("20 40 90")  lcolor("20 40 90")  lwidth(thin)) ///
>     (scatter lblpos xpos, msymbol(none) mlabel(ballbl) mlabposition(0) mlabsize(small) mlabcolor(black)) ///
>     , yline(0, lcolor(black%50) lwidth(thin)) ///
>       xlabel(1.35 "Wave 1 (3.5 years)" 3.35 "Wave 2 (4.5 years)", noticks) ///
>       xscale(noline range(0.4 4.3)) xtitle("") ///
>       ylabel(-1200(200)200, angle(0) labsize(small)) ///
>       ytitle("Per-capita fiscal balance (2020 USD/year)", size(small)) ///
>       legend(order(1 "PEP-eligible" 2 "Ineligible comparison") ///
>              cols(2) position(6) ring(1) size(small) ///
>              region(fcolor(white) lcolor(white))) ///
>       graphregion(color(white)) plotregion(color(white)) ///
>       bgcolor(white) ///
>       ysize(4) xsize(7)
r; t=6.06 13:02:28

. graph export "$tfigs/fig_fiscal.pdf", replace
file ../outputs/figures/fig_fiscal.pdf saved as PDF format
r; t=2.36 13:02:31

. di "  fig_fiscal.pdf saved"
  fig_fiscal.pdf saved
r; t=0.00 13:02:31

. 
. restore
r; t=0.00 13:02:31

. 
. log close
      name:  <unnamed>
       log:  C:\Users\wb614536\Downloads\replication\replication\code\../outputs/12_FiscalAnalysisW2_log.txt
  log type:  text
 closed on:  25 Jun 2026, 13:02:31
--------------------------------------------------------------------------------------------------------------------
